// pages/addteam/index.js
Page({

      /**
       * 页面的初始数据
       */
      data: {
        userId:"",
        JoinTeamId: "",
        JoinName:"",
        JoinTeamreamrk:""
      },

      onload: function (e) {

      },
      //将团队ID传入
      getAddTeamId: function (e) {
        let value = e.detail.value;
        console.log(e.detail.value)
        this.setData({
          JoinTeamId: value,
        })
        wx.setStorageSync('JoinTeamId', value);
      },
      //将队长名字传入
      JoinName: function (e) {
        let value = e.detail.value;
        console.log(e.detail.value)
        this.setData({
          JoinName: value,
        })
        wx.setStorageSync('JoinTeamName', value);
      },
      // //讲电话传入
      // getLeaderTelrName: function (e) {
      //   let value = e.detail.value;
      //   console.log( e.detail.value)
      //   // this.setData({
      //   //   AddTeamName: value,
      //   // })
      //   wx.setStorageSync('getLeaderTelrName', value);
      // },
      //备注传入
      JoinTeamreamrk: function (e) {
        let value = e.detail.value;
        // console.log( e.detail.value)
        this.setData({
          JoinTeamreamrk: value,
        })
        wx.setStorageSync('JoinTeamreamrk', value);
      },
      //向后端传值
      submitMemberInfo: function (e) {
        let StudentID = wx.getStorageSync("StudentID");
        // console.log(userId);
        this.setData({
          StudentID: StudentID,
        })
          var that = this;
          //像后端传值
          wx.request({
            url: 'http://172.17.60.141//group/Member',
            data: {
              StudentID: StudentID,//学号
              GroupID: this.data.JoinTeamId,//团队id
              Auth:2
            },
            header: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            method: 'POST',
            // header: {}, // 设置请求的 header 默认是application/json
            success: function (res) {
              // console.log(res.data)
              that.setData({ //this.setData的方法用于把传递过来的id转化成小程序模板语言
                data: res.data //拿到该商品详情对应的商品id，再调用getProdutInfo方法
              })
            },
            fail: function () {
              // fail
              console.log("false");
            },
            complete: function () {
              // complete
            }
          })
          wx.showModal({
            title: '提示',
            content: "你的申请已成功提交请耐心等待审核",
            success: (res) => {
              wx.switchTab({
                url: '/pages/team/index',
              })
            }
          })
        }
      })